<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->


<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
   
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="Obtaining the Token Information">
<meta name="product" content="">
<meta name="DC.Relation" scheme="URI" content="kubernetes_CSI_00078_2.html">
<meta name="prodname" content="">
<meta name="version" content="">
<meta name="brand" content="30-OceanProtect Appliance 1.5.0-1.6.0 Help Center">
<meta name="DC.Publisher" content="20241029">
<meta name="documenttype" content="usermanual">
<meta name="prodname" content="csbs">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="kubernetes_CSI_00078_5">
<meta name="DC.Language" content="en-us">
<link rel="stylesheet" type="text/css" href="public_sys-resources/commonltr.css">
<title>Obtaining the Token Information</title>
</head>
<body style="clear:both; padding-left:10px; padding-top:5px; padding-right:5px; padding-bottom:5px"><a name="kubernetes_CSI_00078_5"></a><a name="kubernetes_CSI_00078_5"></a>

<h1 class="topictitle1">Obtaining the Token Information</h1>
<div><p>This section describes how to obtain the token of the super administrator during subsequent cluster registration in token authentication mode. The token obtained using the method described in this section can be used permanently.</p>
<div class="section"><h4 class="sectiontitle">Procedure</h4><ol><li><span>Log in to the Kubernetes cluster in the background.</span></li><li><span>Run the following command to create a service user with the specified name. The following steps use the created username <em id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_i857515111817">test</em> as an example.</span><p><pre class="screen" id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_screen774314917566">oc create serviceaccount<em id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_i15731183210564"> </em><em id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_i526717330560">Username</em></pre>
</p></li><li><span>Run the following command to grant the <strong id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_b1952553315176">cluster-admin</strong> role to user <em id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_i996611815180">test</em>:</span><p><pre class="screen" id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_screen1445974610356">oc adm policy add-cluster-role-to-user cluster-admin -z <em id="kubernetes_CSI_00078_5__kubernetes_csi_00078_4_i166264116452">test</em></pre>
</p></li><li id="kubernetes_CSI_00078_5__li1375865225918"><a name="kubernetes_CSI_00078_5__li1375865225918"></a><a name="li1375865225918"></a><span>Run the <strong>oc describe ServiceAccount</strong> <em>test</em> command to obtain the secret name of the user, which is the value of <strong>Tokens</strong>.</span><p><p><span><img src="en-us_image_0000001940549309.png"></span></p>
</p></li><li><span>Run the following command to obtain the token information. The value of <strong>token</strong> is the token of the super administrator (<strong>test-token-7zrz9</strong> is the secret name obtained in <a href="#kubernetes_CSI_00078_5__li1375865225918">4</a>).</span><p><pre class="screen">oc describe secret <em>test-token-7zrz9</em></pre>
</p></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="kubernetes_CSI_00078_2.html">Preparing for Backup (Applicable to OpenShift)</a></div>
</div>
</div>

<div class="hrcopyright"><hr size="2"></div><div class="hwcopyright">Copyright &copy; Huawei Technologies Co., Ltd.</div></body>
</html>